<?php
class Variables_Form_Crearvariable extends Form_Base{
	
	public function __construct($options = null) {
		parent::__construct($options);
	}
	
	public function init() {
		$this->setName('variable');
		$this->setMethod("post");
		$this->setAttrib('enctype', 'multipart/form-data');
		$domConfig = Zend_Registry::get('domConfig'); //esto se crea en el bootstrap
		
		$array_elements[] = new Zend_Form_Element_Hidden("codvariable");
		
		$element = new Zend_Form_Element_Textarea('idvariable');
		$element->setLabel('ID - Identificador  :');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
		$element->addFilter('StringToUpper');
		$element->setAttrib("rows",2);
        $array_elements[] = $element;
		
		$element = new Zend_Form_Element_Textarea('nombrevariable');
		$element->setLabel('Nombre :');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
		$element->addFilter('StringToUpper');
		$element->setAttrib("rows",2);
		$element->addValidator('StringLength', false, array($domConfig->TEXTO_TAMANOMIN));
        $array_elements[] = $element;

		$element = new Zend_Form_Element_Textarea('descripcion');
		$element->setLabel('Descripción :');
		$element->setRequired(true);
		$element->addFilter('StripTags');
		$element->addFilter('StringTrim');
		$element->setAttrib("rows",2);
		$element->addValidator('StringLength', false, array($domConfig->TEXTO_TAMANOMIN));
		$array_elements[] = $element;
		
		$element = new Zend_Form_Element_Select('periodicidad');
		$element->setLabel ( 'Periodicidad: ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->PERIODICIDAD->toArray());
		$element->setValue(1);
        $array_elements[]=$element;
        		
		$element = new Zend_Form_Element_Select('tiponaturaleza');
		$element->setLabel ( 'Tipo de naturaleza : ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->TIPONATURALEZA->toArray());
		$element->setValue(1);
        $array_elements[]=$element;
		
		$element = new Zend_Form_Element_Select('tipocuantitativa');
		$element->setLabel ( 'Tipo de variable: ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->TIPOCUANTITATIVA->toArray());
		$element->setValue(1);
        $array_elements[]=$element;
		
		$element = new Zend_Form_Element_Select('tipogrado');
		$element->setLabel ( 'Grado de complejidad: ' );
		$element->setRegisterInArrayValidator(false);
		$element->setMultiOptions($domConfig->TIPOGRADO->toArray());
		$element->setValue(1);
        $array_elements[]=$element;
        
		$element = new Zend_Form_Element_Submit ( 'btnSubmit' );
		$element->setValue('Guardar');
		$element->setLabel("Guardar");
		$element->setAttrib("class", "iceCmdBtn");
		$array_elements[] = $element;
		
		$this->addElements ($array_elements);
		
		$this->loadTableDecorators();
	}
	
}